Indirect Shooting Method


In [1]:
import sys
sys.path.append('../')
from Trajectory import Point_Lander
from Optimisation import Indirect_Shooting
from PyGMO import *


/usr/lib/python2.7/dist-packages/matplotlib/__init__.py:874: UserWarning: axes.color_cycle is deprecated and replaced with axes.prop_cycle; please use the latter.
  warnings.warn(self.msg_depr % (key, alt_key))

In [2]:
model = Point_Lander()
prob = Indirect_Shooting(model)

In [4]:
algo = algorithm.scipy_slsqp(screen_output=True)
for i in range(50):
    pop = population(prob,1)
    pop = algo.evolve(pop)
    if prob.feasibility_x(pop.champion.x):
        print("YES")
        break
    else:
        print("NO. Trying again.")


  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
    6    22     1.000000E+00     0.000000E+00
Optimization terminated successfully.    (Exit mode 0)
            Current function value: 1.0
            Iterations: 6
            Function evaluations: 22
            Gradient evaluations: 2
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    5     8     1.000000E+00     0.000000E+00
Optimization terminated successfully.    (Exit mode 0)
            Current function value: 1.0
            Iterations: 5
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.
  NIT    FC           OBJFUN            GNORM
    1     8     1.000000E+00     0.000000E+00
Singular matrix C in LSQ subproblem    (Exit mode 6)
            Current function value: 1.0
            Iterations: 1
            Function evaluations: 8
            Gradient evaluations: 1
NO. Trying again.

In [ ]:
pop = algo.evolve(pop)

In [ ]:
pop

In [ ]: